<template>
  <div>
  <div id="co_header">
            <el-header>
                <h1>{{co_name}}</h1>
            </el-header>
        </div>
  </div>
</template>

<script>
export default {
        name: 'co_header',
        data() {
            return {
                co_name: "",
            }
        },
        methods: {
            loadCourseData() {
                this.axios
                    .get("http://10.197.43.62:8088/student/student_course?st_id="+this.st_id)
                    .then((res) => {
                       
                        for (let i=0; i < res.data.length; i++) {
                            if (res.data[i].co_id == this.CoId) {
                                this.co_name = res.data[i].co_name
                            }
                        }
                    });
            },
          
        },
        mounted() {
            this.loadCourseData();
        },
        computed: {
            CoId() {
                return this.$store.state.co_id;
            },
             st_id() {
      return this.$store.state.st_id;
    },
        }
    }
</script>

<style scoped>
    #co_header h1 {
        text-align: center;
        line-height: 60px;
        height: 60px;
        width: 300px;
        margin: 0 auto;
        font-size: 30px;
    }
</style>
